package jui.business.vo
{
	public class MessageIdVO
	{
		private var _mid: String = ""; 
		private var _rid: String = "";
		
		/**
		 * Converts message id like " #12345/6" to typed MessageID Value object with properties mid and rid    
		 * @param messageId String, like " #12345/6", "#12345" or "12345/6"
		 * @return MessageIdVO, a typed object with parsed message ID (mid) and reply ID (rid)   
		 * 
		 */		
		public function MessageIdVO(messageId: String)
 		{
			var idToTest: String = messageId; 
			
			//idToTest = "112341/2";
			
			var regExMessageId: RegExp = /\s*\#*(\d+)(\/)*(\d*)\s*/g;
			
			var a: Array = messageId.match( regExMessageId ); 
			
			mid = messageId.replace( regExMessageId, "$1" );
			rid = messageId.replace( regExMessageId, "$3" );
			
			rid = rid.replace( "/", "" );
 		}
		
		public function get mid():String
		{
			return _mid;
		}

		public function set mid(value:String):void
		{
			_mid = value;
		}

		public function get rid():String
		{
			return _rid;
		}

		public function set rid(value:String):void
		{
			_rid = value;
		}
	}
}